package com.wc.alorithm_blue_bridge_history.littlewhite.Q231223.Q9989;

import java.io.*;
import java.util.StringTokenizer;

/**
 * @Author congege
 * @Description
 * @Date Created in 2023/12/23-19:41
 */
public class Main {
    static FastReader in = new FastReader();
    static PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));

    public static void main(String[] args) {
        int a = in.nextInt();
        int b = in.nextInt();
        int s = in.nextInt();
        int t = in.nextInt();
        long ans = 0;
        for (int c = s; c <= t; c++) {
            if (a - c >= 0) {
                ans += yins(a - c, b);
            }
        }
        System.out.println(ans);
    }

    public static int yins(int val, int b) {
        int mid = (int) Math.sqrt(val);
        int ans = 0;
        for (int i = 1; i <= mid; i++) {
            if (val % i == 0) {
                if (i <= b) {
                    ans++;
                }
                if (val / i <= b) {
                    ans++;
                }
            }
        }
        if (mid * mid == val) {
            if (mid <= b) {
                ans--;
            }
        }
        return ans;
    }
}

class FastReader {
    StringTokenizer st;
    BufferedReader br;

    FastReader() {
        br = new BufferedReader(new InputStreamReader(System.in));
    }

    String next() {
        while (st == null || !st.hasMoreElements()) {
            try {
                st = new StringTokenizer(br.readLine());
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        return st.nextToken();
    }

    long nextLong() {
        return Long.parseLong(next());
    }

    int nextInt() {
        return Integer.parseInt(next());
    }
}
